  
//ligerUI-grid option
function grid_ops(){
		return {      
		    enabledSort:false,
		    pageSize:15,
		    width: '100%',
		    height:'88%',
		    root:'rows',
		    record :'total',
		    pageParmName :'page',
		    pagesizeParmName :'pageSize',
		    method:'post',
		    dataAction:'server',
		    delayLoad :true,
		    pageSizeOptions:[10, 15, 20, 30, 40, 50],
		    onSuccess:function(data, grid){
		  	  if(data.hasError){
		  	    $.ligerDialog.error(data.message);
		  	    return false;
		  	  }
		    },
		    onAfterShowData:function(data){
		  	
		    }
	} ;
}

//开窗口
function openWindow(url, title, width, height)
{
    return $.ligerDialog.open({ width: width, height: height, title: title, url: url, buttons: [
    { text: '关闭', onclick: function ()
    {
    	hideCurrentWindow();
    } 
    }
    ], isResize: true
    });
}


function hideCurrentWindow(){
	 $.ligerDialog.close();
     $.ligerDialog.hide();
}

function init_validate(fromid){
	$.metadata.setType("attr", "validate");
	var f;
	if(fromid==undefined){
		f=$("form");
	}else{
		f=$("#"+formid);
	}
	var v = f.validate({
	  errorPlacement: function (lable, element)
	  {
	      lable.appendTo($(element).parent().next());
	  },
	  success: function (lable)
	  {
	      lable.ligerHideTip();
	      lable.remove();
	  },
	  submitHandler: function ()
	  {
	      $("form .l-text,.l-textarea").ligerHideTip();
	  }
	});
	return v;
}


$.ligerDefaults.Grid.formatters['datetime'] = function (datatime, column) {
    //num 当前的值
    //column 列信息
	if(Number(datatime)>0){
		  return  new Date(datatime).format("yyyy-MM-dd hh:mm:ss");
	}
};
$.ligerDefaults.Grid.formatters['datetime2'] = function (datatime, column) {
    //num 当前的值
    //column 列信息
	if(Number(datatime)>0){
		  return  new Date(datatime).format("yyyy-MM-dd hh:mm");
	}
};
$.ligerDefaults.Grid.formatters['fee'] = function (fee, column) {
    //num 当前的值
	if (!fee) return "0.00";
	return $.FormatMoney(fee);
	
	
};

